package com.example.asus.myapplication0;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity{
    private Button clickBtn;
    private TextView showText;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        showText=(TextView) findViewById(R.id.showText);
        clickBtn=(Button) findViewById(R.id.clickBtn);

        clickBtn.setOnClickListener(new View.OnClickListener(){
            @Override
                    public void onClick(View v){
                        showText.setText("按钮被单机。");
            }
        });
        showText.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Toast.makeText(MainActivity.this,"文本框被点击。。。",Toast.LENGTH_LONG).show();
        }
    });


    }
}
